<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<%
	//获取获取住院记录
	String cardNo = input.getDesc("cardNo","32022219470310081X");
	String patientName = input.getDesc("patientName","吴家洪");
	List<Map> list = QBuilder.db("basedb").queryHql("select new map( s.syxh as syxh ,s.blh as blh , s.mzh as mzh , s.hzxm as hzxm ,s.sfzh as sfzh , s.ryrq as ryrq ,s.cyrq as cyrq, s.cqrq as cqrq, s.cyzdmc as cyzdmc ,s.memo as memo,bq.name as bqmc ,yg.name as doctorName , bq.yymc as yymc) from sheet s , ZY_BQDMK  bq , YY_ZGBMK yg where s.bqdm= bq.id and s.ysdm = yg.id and s.sfzh = '"+cardNo+"' and s.hzxm = '"+ patientName +"' order by s.ryrq desc");

	for(Map map : list){
		String date =map.get("ryrq").toString();
		String date2 =map.get("cyrq") == null || map.get("cyrq").toString().trim().length()==0 ? "" : map.get("cyrq").toString();
		String date3 =map.get("cqrq") == null || map.get("cqrq").toString().trim().length()==0  ? "" : map.get("cqrq").toString();
		
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhh:mm:ss");
		SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		map.put("ryrq",sdf1.format(sdf.parse(date)));
		if(!"".equals(date2) ){
			map.put("cyrq",sdf1.format(sdf.parse(date2)));
		}
		if(!"".equals(date3) ){
			map.put("cqrq",sdf1.format(sdf.parse(date3)));
		}
		

	
	}
	
	Message msg = new Message();
	msg.put("errcode",0);
	msg.put("data",list);
	Tools.print(out,msg);
%>